<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="renderer" content="webkit" />
<link href="https://e11.edu-edu.com.cn/exam/statics/styles/green/normal/exam/exam_card2.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/snapshot/layer-v3.1.1/layer.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/base_tools.js"></script>
<link rel="shortcut icon" href="https://e11.edu-edu.com.cn/exam/statics/images/favicon.png" type="image/png"/>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/exam_card2.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/MD5.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/json2.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/snapshot/layer-v3.1.1/layer.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/utils/baseTools.js"></script>
<script type="text/javascript" src="https://e11.edu-edu.com.cn/exam/statics/scripts/utils/functions.js"></script>
<title>考试系统</title>
<style>
	body{
		overflow: hidden;
	}
	.white-btn{
		display: inline-block;
		text-align:center;
		background-color:white;
		vertical-align: text-bottom;
		width:20px;
		font-size: 20px;
		line-height: 1;
		border:1px solid #333;
		color:#333;
	}
	.white-txt{
		font-size: 12px;
	    vertical-align: text-top;
	    color: #e65c40;
	}
</style>
</head>
<body>
	<div id="ui_wrapper" >
		<div class="ui-header ui-component">
			<div class="ui-logo">
				<div style="float:left;" id="imageLogo" ></div>
				<div class="ui-header-title"  style="font-size:1.34em;padding:0 15px;line-height:55px;"></div>
				<span onclick="__ExamIns.windowReload()" class="ui-botton-refresh"></span>
			</div>
		</div>
		<div class="ui-main">
			<div class="ui-iframe-wrapper">
				<div class="ui-paper-loading">试卷加载中...</div>
				<iframe frameborder="0" class="ui-paper-iframe"></iframe>
				<div class="ui-main-footer-toolbar ui-component">
					<button id="pre-btn" onclick="__ExamIns.offsetQuestion(-1)">上一题</button> 
					<button id="next-btn" onclick="__ExamIns.offsetQuestion(1)">下一题</button>
					<span class="white-btn" onclick="setFontSize(2,'sub')">-</span>
					<span class="white-txt">字号</span>
					<span class="white-btn" onclick="setFontSize(2,'add')">+</span>
					
					<div class="ui-right">
						<button class="ui-action-submit" onclick="__ExamIns.Submit()">交卷</button>
					</div>
				</div>
			</div>
			<div class="ui-card-panel">
				
				<div class="ui-card-title ui-right-component"><span class="label">答题卡</span></div>
				<div class="ui-card-questions"></div>
				<div id="last-monitor" style="display: none;" class="ui-monitor-div ui-right-component">
					<div id="last-camera"></div>
				</div>
			</div>
		</div>
		<div class="ui-footer ui-component">Copyright © 2024</div>
		<div id="pop-monitor" class="authentication-box">
			<div class="photo-list">
				<div class="default-img">
					<img id="examPhoto2" src="">
				</div>
				<div class="photograph-box">
					<div id="photograph-box">
						<div class="renlian">
							<div class="box">
								<div class="line"></div>
								<div class="bottom"></div>
							</div>
						</div>
					</div>
					<div id="pop-camera"></div>
				</div>
			</div>
			<div class="tips">
				<div class="message"></div>
				<p>操作提示:</p>
				<ul>
					<li>1.请先确保摄像头设备已连接并能正常工作;</li>
					<li>2.请保持光源充足，不要逆光操作;</li>
					<li>3.请保证脸部正面面向摄像头，并适当调整姿势保证整个脸部能够进入下方识别画面;</li>
					<li>4.系统识别通过后，将自动跳转进入考试界面。</li>
				</ul>
				<div class="buttonbox" style="display: none;">
					<button id="confirm">确定</button>
				</div>
			</div>
		</div>
	</div>
	<div id="my-hand-draw" style="display: none">
		<div id="my-canvas"><canvas id="myCanvas"></canvas></div>
		<div id="controllbar"><button class="ui-clear">册除</button><button class="ui-ok">确定</button></div>
	</div>
	<script type="text/javascript">

	function setFontSize(num,type){
		const paperWrapper = document.querySelector('.ui-paper-iframe').contentDocument.querySelector('.ui-paper-wrapper')
		//const fontSize = paperWrapper.css
		const fontSize = window.getComputedStyle(paperWrapper, null).getPropertyValue("font-size")
		if(type == "add"){
			if(parseInt(fontSize) < 24){
				paperWrapper.style.fontSize = parseInt(fontSize) + num;
			}
		}else{
			if(16 < parseInt(fontSize)){
				paperWrapper.style.fontSize = parseInt(fontSize) - num;
			}
		}
	}
	
	(function($,win){
		$(document).ready(function(){
			let jwin=$(win), enableExam = {loadIndex: true,}, _examWithClient = false;;
			let iframe=$('.ui-paper-iframe'),loading=$('.ui-paper-loading');
			let allHeight=0, rightHeight = 0;
			let answerCard = $('.ui-card-questions');
			$('.ui-component').each(function(){
					let t=$(this);
					allHeight+=t.outerHeight();
			});
			function onResizeWindow(){
					rightHeight = 0;
					$('.ui-right-component:visible').each(function(){
						let t=$(this);
						rightHeight+=t.outerHeight();
					});
					let documentHeight=jwin.height()-allHeight;
					let answerCardHeight = documentHeight - rightHeight + 40;
					iframe.height(documentHeight);
					loading.height(documentHeight);
					answerCard.height(answerCardHeight);
			}
			jwin.on('resize',onResizeWindow);
			onResizeWindow();
			// 考务的用户显示信息，用户的照片，用户的人脸识别功能
			
			let checkCanStartMaxCount = 50, currentCheckStartCount = 0;
            checkCanStartExam();
            // 反复检查用户是否加载完成
			function checkCanStartExam(){
				currentCheckStartCount ++ ;
				if(currentCheckStartCount > checkCanStartMaxCount){
					layer.alert('考试环境没有初始化成功，请稍后刷新再试', { title: ['错误提示', 'font-weight:bold'], type: 0, icon: 2, closeBtn: 1, btn: [] });
					return;
				}
				let startExam = true;
				for(let key in enableExam){
					startExam = startExam && enableExam[key];
				}
				if(startExam){
				    __allLoadingIsDoneBeginUserExam();
                    return;
				}else{
					setTimeout(function(){
						checkCanStartExam();
					},300);
				}
			}
            // 最主要的方法加载试卷，初使化参数
			function __allLoadingIsDoneBeginUserExam(){
				let subjAnswerType = '0';
			    // 如果是客户端的考试，不显示拍照的按钮
			    if(_examWithClient && (subjAnswerType & 2) == 2){
                    subjAnswerType = subjAnswerType - 2;
			    }

			    let theirPapersURL = "";
			    let extendedDurationURL = "";
			    
			    win.__ExamIns=new ExamObj(0,'80976_350111198112051912_202504_fzugk_1742635842055',-17013,false,false,false,subjAnswerType,'/static/json',theirPapersURL,extendedDurationURL);
			    setTimeout(function(){
			        iframe.prop('src','83__index.html');
			    },200);
			}
			// 启用摄像头拍照的功能调用
            // try {
            //     window.__takePicture = new TakePicture({id:'camera-container'});
            // }catch(error){
            //     console.log(error);
			// }
			
			// 启用手写公式
            try {
                window.__handDraw = new HandDraw($('#my-hand-draw'), 300, 150);
            }catch(error){
                console.log(error);
            }
		});
	})(jQuery,window);
	</script>
</body>
</html>
